package edu.msg.hrappy.backend.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table(name="User")
public class User extends BaseEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String firstName;
	private String lastName;
	private String telNumber;
	private String mobilNumber;
	private String email;
	private String functionInCompany;
	private String description;
	private String userName;
	private String roleInCompany;
	private String password;
	private List<UserGroup> userGroups;
	private List<Notification> notifications;
	
	public User(){
		//CONSTR
	}
	
	public User(Long id, String firstName, String lastName, String telNumber,
			String mobilNumber, String email, String functionInCompany,
			String description, String userName,  String password, String roleInCompany) {
		super(id);
		this.firstName = firstName;
		this.lastName = lastName;
		this.telNumber = telNumber;
		this.mobilNumber = mobilNumber;
		this.email = email;
		this.functionInCompany = functionInCompany;
		this.description = description;
		this.userName = userName;
		this.password = password;
		this.roleInCompany = roleInCompany;
		
	}
	
	
	public User(String firstName, String lastName, String telNumber,
			String mobilNumber, String email, String functionInCompany,
			String description, String userName, String password, String roleInCompany) {
		super();
		this.firstName = firstName;
		this.lastName = lastName;
		this.telNumber = telNumber;
		this.mobilNumber = mobilNumber;
		this.email = email;
		this.functionInCompany = functionInCompany;
		this.description = description;
		this.userName = userName;
		this.password = password;
		this.roleInCompany = roleInCompany;
		
	}
	@Column(name="firstName")
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	@Column(name="lastName")
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	@Column(name="telNumber")
	public String getTelNumber() {
		return telNumber;
	}
	public void setTelNumber(String telNumber) {
		this.telNumber = telNumber;
	}
	@Column(name="mobilNumber")
	public String getMobilNumber() {
		return mobilNumber;
	}
	public void setMobilNumber(String mobilNumber) {
		this.mobilNumber = mobilNumber;
	}
	@Column(name="email")
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	@Column(name="functionInCompany")
	public String getFunctionInCompany() {
		return functionInCompany;
	}
	public void setFunctionInCompany(String functionInCompany) {
		this.functionInCompany = functionInCompany;
	}
	@Column(name="description")
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	@Column(name="userName")
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	@Column(name="roleInCompany")
	public String getRoleInCompany() {
		return roleInCompany;
	}
	public void setRoleInCompany(String roleInCompany) {
		this.roleInCompany = roleInCompany;
	}
	@Column(name="password")
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	@OneToMany(mappedBy = "user")
	public List<UserGroup> getUserGroups() {
		return userGroups;
	}

    public void setUserGroups(List<UserGroup> userGroups) {
        this.userGroups = userGroups;
    }

    @OneToMany(mappedBy="user")
    @JoinColumn(name="USER_ID")
	public List<Notification> getNotifications() {
		return notifications;
	}

	public void setNotifications(List<Notification> notifications) {
		this.notifications = notifications;
	}
        
	public void setNotification(Notification notification) {
        this.notifications.add(notification);
    }    
}
